package com.coocaa.ops.admin.v1.upload.properties;

import com.alibaba.nacos.api.config.annotation.NacosConfigurationProperties;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

/**
 * @author tangminghong
 * @date 2020-06-18
 */
@Component
@NacosConfigurationProperties(dataId = "admin-upload.yml", groupId = "${nacos.config.group}", autoRefreshed = true)
@Getter
@Setter
public class FtpProperties implements InitializingBean {

    /**
     * ftp 主机
     */
    private String ftpHost;
    /**
     * ftp 端口
     */
    private Integer ftpPort;
    /**
     * 账号
     */
    private String ftpUsername;
    /**
     * 密码
     */
    private String ftpPassword;

    @Override
    public void afterPropertiesSet() throws Exception {
        Constants.FTP_HOST = ftpHost;
        Constants.FTP_PORT = ftpPort;
        Constants.FTP_USERNAME = ftpUsername;
        Constants.FTP_PASSWORD = ftpPassword;
    }

    public static final class Constants {
        /**
         * FTP 主机IP
         */
        public static String FTP_HOST;
        /**
         * FTP 主机端口
         */
        public static Integer FTP_PORT;
        /**
         * FTP 登录用户名
         */
        public static String FTP_USERNAME;
        /**
         * FTP 登录密码
         */
        public static String FTP_PASSWORD;
    }
}
